namespace Mytodotodaylist.WF.Client
{
    using Core.Container;
    using Core.Events;
    using Core.History;
    using Core.Notifications;
    using Core.Schedule;
    using DataAccess;
    using FluentAdoDotNet;
    using Views.AddEditView;
    using Views.MainView;

    public class Bootstrapper
    {
        public static void Configure()
        {
            Bind<IMainView>.To<MainFormImpl>();
            Bind<IAddEditView>.To<AddEditFormImpl>();
            Bind<MainPresenter>.To<MainPresenter>();
            
            Bind<INotificationService>.To<NotificationService>();
            Bind<EvaluationTask>.To<EvaluationTask>();
            Bind<IEventRepository>.To<EventRepositoryImpl>();
            Bind<IHistoryService>.To<HistoryService>();

            // set target db
            ConnectionFactory.DbPath = "mytodotodaylist.sdf";

            // keep this the last
            var scheduler = new Scheduler(1000);
            scheduler.RegisterTask(IoC.Resolve<EvaluationTask>());
            scheduler.Start();
            Bind<Scheduler>.ToInstance(scheduler);
        }
    }
}